home *** CD-ROM | disk | FTP | other *** search
- TITLE Word-Averaging Procedure (EX43.ASM)
- PAGE ,132
- OUR_CODE SEGMENT PARA 'CODE'
- PUBLIC AVERAGE
- AVERAGE PROC FAR
- ASSUME CS:OUR_CODE
- SUB AX,AX ;Clear dividend to start
- SUB DX,DX
- PUSH CX ;Save word count on stack
- ADD_W: ADD AX,[BX] ;Add next word to total
- ADC DX,0
- ADD BX,2 ; and update the total
- LOOP ADD_W ;All words now totaled?
- POP CX ; Yes. Retrieve word count
- DIV CX ; and take the average
- RET
- AVERAGE ENDP
- OUR_CODE ENDS
- END AVERAGE
-